package com.soft.web;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.soft.dao.PhoneDao;
import com.soft.domain.Phone;

public class UpdatePhoneUI extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String userid=req.getParameter("userid");
		PhoneDao dao=new PhoneDao();
		Phone phone=new Phone();
		try {
			phone=dao.getPhone(userid);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		HttpSession session =req.getSession();
		session.setAttribute("phone", phone);
		req.setAttribute("phone", phone);
		req.getRequestDispatcher("/WEB-INF/jsp/updatephone.jsp").forward(req, resp);
		
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		doGet(req,resp);
	}

}
